﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using XinYi.CroodedShowFront.BLL;
using XinYi.CrookedShowMode;
using XinYi.CrookedShow.BLL;
using XinYi.CrookedShow.Models;
using XinYi.CrookedShowMode;

namespace XinYi.CrookedShow.Controllers
{
    public class HomeController : Controller
    {
        PageService pageService = new PageService();
        #region 一级货架
        public ActionResult All_cl()
        {
            return View();
        }
        #endregion
        #region 歪秀购物(黑糖)
        public ActionResult All_class()
        {
            return View();
        }
        #endregion
        #region 提交订单成功
        public ActionResult D_success()
        {
            return View();
        }
        #endregion       
        #region 二级分类
        public ActionResult Erji_class()
        {
            return View();
        }
        #endregion
        #region 主界面
        public ActionResult Index()
        {
            IndexService index = new IndexService();
            
            List<Category> list3 = index.GetCategoryList();
            List<Category> two = index.GetTwoList2();
            List<Category> three = index.GetThreeList3();
            List<ProductSpuInfo> list2 = index.GetProduct_SpuList();
            List<Brand> list1= index.GetBrandList();
            List<ProductSpuInfo> List2 = index.GetProduct_SpuList();
            List<Brand> List1 = index.GetBrandList();



            ViewBag.List1 = list1;
            ViewBag.List2 = list2;
            ViewBag.List3 = list3;
            ViewBag.Two = two;
            ViewBag.Three = three;
            return View();
        }
        #endregion
        #region 登录
        public ActionResult Login()
        {
            //取出Cookie保存的信息
            HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies.Get("CookieName");
            if (cookie != null)
            {
                string name = cookie["Name"];//等同于string name = cookie.Values.Get("UserName");
                string pwd = cookie["Password"];
                //DateTime time = DateTime.Parse(cookie["DateTime"]);

                if (name != null && pwd != null && DateTime.Parse(cookie["DateTime"]) != null && DateTime.Now < DateTime.Parse(cookie["DateTime"]))
                {
                    //将Cookie中的值赋给上下文session  使其在不登录时页面也能够显示
                    UserInfoContext.adminContext.adminInfo = new UserInfo()
                    {
                        UserName = name,
                        Pwd = pwd
                    };
                    return Redirect("/Home/Index");
                }
            }
            return View();
        }
        #endregion
        #region 会员系统地址管理
        public ActionResult My_add()
        {
            return View();
        }
        #endregion
        #region 会员系统退货申请(我的订单)
        public ActionResult My_d()
        {
            return View();
        }
        #endregion
        #region 会员系统我的订单
        public ActionResult My_d_info()
        {
            return View();
        }
        #endregion
        #region 会员系统我的评价
        public ActionResult My_p()
        {
            return View();
        }
        #endregion
        #region 会员系统我的收藏
        public ActionResult My_s()
        {
            return View();
        }
        #endregion
        #region 会员系统帮助中心(账户安全)
        public ActionResult My_user()
        {
            return View();
        }
        #endregion
        #region 会员系统帮助中心(商城快讯)
        public ActionResult New()
        {
            return View();
        }
        #endregion
        #region 填写核对订单
        public ActionResult Order()
        {
            return View();
        }
        #endregion
        #region 商品详情
        public ActionResult Page()
        {

            //查询商品
            Product_Spu product_Spu = pageService.product(1);
            ViewBag.Product = product_Spu;
            //分类
            ViewBag.Categorys = pageService.Categorys(product_Spu);
            //商品规格
            ViewBag.Spec = pageService.Spec(1);
            //规格值
            ViewBag.Spec_Value = pageService.Spec_Value(1);
            //Product_Sku表库存
            ViewBag.Product_Sku = pageService.Product_Sku(1);
            //评论
            ViewBag.Product_Comment = pageService.Product_Comment(1);
            //图片
            ViewBag.Pics = pageService.Pics(1);
            return View();
        }
        #endregion
        #region 用户注册
        public ActionResult Register()
        {
            return View();
        }
        #endregion
        #region 会员系统退货申请(退货申请)
        public ActionResult Request()
        {
            return View();
        }
        #endregion
        #region 会员系统退货申请(退货记录)
        public ActionResult Retreat_cha()
        {
            return View();
        }
        #endregion
        #region 会员系统退货申请(退货记录)
        public ActionResult Retreat()
        {
            return View();
        }
        #endregion
        #region 歪秀购物(限时抢购)
        public ActionResult Sale()
        {
            return View();
        }
        #endregion
        #region 歪秀购物(限时抢购)
        public ActionResult Sale_begin()
        {
            return View();
        }
        #endregion
        #region 歪秀购物(没有查询到商品)
        public ActionResult Search()
        {
            return View();
        }
        #endregion
    }
}